<extend name="work/base"/>
<block name="content">
    <style>
        .notify_li{
            line-height:32px;
            cursor:pointer;
        }
        .layui-collapse{
            margin-top: 15px;
        }
        .notifyview{
            cursor:pointer;
        }
    </style>
        <form class="layui-form inline-form">
            <div class="pull-left">
                <div class="layui-inline dropdown">
                    <input name="title" class="layui-input" type="text" id="doctitle" placeholder="标题">
                </div>
                <div class="layui-inline">
                    <button class="layui-btn  layui-btn-normal" lay-submit lay-filter="docsearch_btn"><i
                            class="layui-icon">&#xe615;</i>搜索
                    </button>
                </div>

            </div>
        </form>
        <table class="layui-table " id="list" lay-filter="list"
               list-url="{:url('/notify/lists')}"
               edit-url="{:url('notifyedit')}"
               del-url="{:url('notifydelete')}"
               forms-url="{:url('notifyview')}"
        ></table>
</block>
<block name="script">
    <script type="text/javascript">
        layui.use(['element', 'table', 'form', 'tree','layer'], function () {
            var table = layui.table
                , element = layui.element
                ,$=layui.$
                ,layer=layui.layer
                , form = layui.form;
            table.render({
                elem: '#list'
                , url: "{:Url('/notify/lists')}"
                , page: true
                , loading: true
                , limit: 20
                ,page:true
                , cols: [[
                    {field: 'title', templet: '<div><a class="notifyview" ">{{d.category}}|{{d.title}}</a></div>'}
                    ,{field: 'c_time',width: 180}
                ]]
            });
            //监听行单击事件（双击事件为：rowDouble）
            table.on('row(list)', function(obj){
                var data = obj.data;

                //页面层
                layer.open({
                    type: 2,
                    title:'通知公告',
                    skin: 'layui-layer-rim', //加上边框
                    area: ['800px','800px'], //宽高
                    content: ['{:url("/notify/notifyview","","",true)}/id/'+data.id]
                });
            });

            $('.notify_li').click(function () {
                caregory=$(this).attr('category');
                table.reload('list', {
                    url: "{:Url('/notify/lists')}"
                    ,page: {
                        curr: 1
                    }
                    , where: {
                        category_id:caregory
                    } //设定异步数据接口的额外参数
                    //,height: 300
                });
            })
            //监听单元格事件
            form.on('submit(docsearch_btn)', function (data) {
                table.reload('list', {
                    url: "{:Url('/notify/lists')}"
                    , page: {
                        curr: 1
                    }
                    , where: data.field
                });
                return false;
            });
            form.on('select(doc_type)', function (data) {
                table.reload('list', {
                    url: "{:Url('/notify/lists')}"
                    , page: {
                        curr: 1
                    }
                    , where: {
                        status: data.value
                    }
                });
                return false;
            });
        });
    </script>
</block>
